import Vuex from 'vuex';
const SET_COOKIE = "SET_COOKIE"; //得到用户第一次进来的时候的cookie
const USERINFO_INIT = "USERINFO_INIT" //初始化用户信息

const state = {
    userInfo: {},
    setCookie: null,
}
const mutations = {
    [USERINFO_INIT](state, userInfo) {
        state.userInfo = userInfo
    },
    [SET_COOKIE](state, setCookie) {
        state.setCookie = setCookie
    },
};
const actions = {
    userInfo_init({ commit }, userInfo) {
        commit(USERINFO_INIT, userInfo)
    },
    set_cookie({ commit }, setCookie) {
        commit(SET_COOKIE, setCookie)
    }
};
const getters = {
    userInfo: (state) => state.userInfo,
    setCookie: (state) => state.setCookie
};

export default {
    state,
    mutations,
    actions,
    getters
}